<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<body>
<ui:composition template="templateLogin.xhtml">
	<ui:define name="titulo">Login</ui:define>
	<ui:define name="logout"></ui:define>
	<ui:define name="menu"></ui:define>
	<ui:define name="menu_nav"></ui:define>
	<ui:define name="corpo">
			
		<p:panel header="Login" style="width:300px; margin-left:auto;  margin-right:auto">			
		  	<h:panelGroup rendered="#{!empty param.login_error}">
				<span style="color: red"> Erro ao efetuar o login.</span><br />
			</h:panelGroup>
			<br/>
			
			<form id="login" method="post" action="${request.contextPath}/j_spring_security_check">
				 <p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" /> 
			<table>
				<tr><td>Login</td>
					<td><input type='text' name='j_username'/></td></tr>
				<tr><td>Senha</td>
					<td><input type='password' name='j_password'/></td></tr>
				<tr><td>&nbsp;</td>
					<td><input type="submit" value="Entrar"/></td>
				</tr>
			</table>
			<script>
				document.getElementById("login").j_username.value = "#{SPRING_SECURITY_LAST_USERNAME}";
			</script>
			</form>	
		</p:panel>
		<br />
			
	</ui:define>
</ui:composition>
</body>
</html>
